package com.usf.jprovider.schema.provider.dao;

import javax.xml.bind.annotation.XmlSeeAlso;

import com.usf.jprovider.object.JObjectNode;
import com.usf.jprovider.object.env.Environment;
import com.usf.jprovider.object.type.JType;
import com.usf.jprovider.schema.provider.AbstractProvider;
import com.usf.jprovider.schema.provider.dao.key.AbstractDAOKeySource;
import com.usf.jprovider.schema.provider.dao.resultset.AbstractDAOResultSetSource;

@XmlSeeAlso({
	AbstractDAOKeySource.class,
	AbstractDAOResultSetSource.class
})
public abstract class AbstractDAOSource extends AbstractProvider{
	
	public AbstractDAOSource() {
		super();
	}

	@Override
	public final JType<?> create(Environment env, JObjectNode node) throws Exception {
		String value = createUnformated(env, node).toString();
		return type.toJType(value);
	}
	
	@Override
	public boolean isDependent(JObjectNode node) throws Exception {
		return false;
	}
	
	protected abstract String createUnformated(Environment env, JObjectNode node) throws Exception;
}
